package com.nineclock.approve.resolver;

import com.nineclock.approve.resolver.impl.*;

import java.util.HashMap;
import java.util.Map;


/**
 * ProcessNodeResolver 工厂类
 */
public class ProcessNodeResolverFactory {
    
    private static Map<String, ProcessNodeResolver> instances = new HashMap<String, ProcessNodeResolver>();
    
    static {
        instances.put("start".toUpperCase(), new StartNodeResolver());
        instances.put("condition".toUpperCase(), new ConditionNodeResolver());
        instances.put("cclist".toUpperCase(), new CCListNodeResolver());
        instances.put("end".toUpperCase(), new EndNodeResolver());
        instances.put("approval".toUpperCase(), new ApproveNodeResolver());
    }

    //根据type, 获取能够处理当前类型节点的 节点处理器
    public static ProcessNodeResolver getInstance(String type){
        return instances.get(type.toUpperCase());
    }
}